package com.apes.hr.recruit.repository;

import com.apes.framework.jpa.repository.CustomRepository;
import com.apes.hr.recruit.model.EmployContract;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;
/**
 * 功能：聘用合同
 *
 * @author HuJianLin
 * @create 2018-04-28 16:07
 */
public interface EmployContractRepository extends CustomRepository<EmployContract, String>{
    List<EmployContract> findAllById(String id);

    @Query(value = "select A.* from hr_Employ_Contract A " +
            "where A.employee_id LIKE  %:value%  ORDER BY A.CREATE_DATE DESC" , nativeQuery = true)
    List<EmployContract>  findByEmployee(@Param("value")String employee);

    @Query(value = "select A.* from hr_Employ_Contract A " +
            "where A.employee_id LIKE  %:value% and a.state != 'repeal' and a.state != 'delete'" +
            "order by a.create_date DESC  " , nativeQuery = true)
    List<EmployContract> findByEmployeeAndStateOrderByCreateDate(@Param("value")String employee);
}
